package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    @Select("select count(*) from student where clazz_id = #{clazzId};")
    Integer countByClazzId(Integer id);

    List<Student> list(StudentQueryParam studentQueryParam);


    void insert(Student student);

    @Select("select * from student where id= #{id} ")
    Student getById(Integer id);

    void update(Student student);


    void delete(List<Integer> ids);

    @Insert("update student set violation_count = violation_count + 1, violation_score = violation_score + #{score} where id = #{id}")
    void score(Integer id, Integer score);

    List<Map<String, Object>> countStudentCountData();

    List<Map<String, Object>> getStudentDegreeData();
}
